package Chapter7;
//150页程序7.7

import java.io.*;

public class BankAccount_PrintWriterTest {
    public static void main(String[] args) {
        try {
            PrintWriter out = new PrintWriter(new FileWriter("myAccount.txt"));
            BankAccount aBankAccount = new BankAccount("刘梅", 2023533,3459827);
            out.println(aBankAccount.getOwnerName());
            out.println(aBankAccount.getAccountNumber());
            out.println("$" + aBankAccount.getBalance());
            out.close();
        } catch (FileNotFoundException e) {
            System.out.println("文件未找到");
        } catch (IOException e) {
            System.out.println("无法写入文件！");
        }
    }
}
//Object——Writer——OutputStreamWriter——FileWriter
//Writer——PrintWriter